<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        // 函数的arguments
        function fn () {
            var sum = 0;
            for (var i = 0; i < arguments.length; i++) {
                var subArr = arguments[i]; // [1, 2]
                for (var j = 0; j < subArr.length; j++) {
                    sum += subArr[j];
                }
            }
            console.log(sum);
        }

        console.log(sum); // sum is not defined
        // fn([1, 2, 3, 4, 5]); // 15

        fn([1, 2], [3, 4], [5, 6, 7]); // 28

        // var 的作用域
        // let const

        var i;

        function fn (arr) {
            for (i = 0; i < arr.length; i++) {

            }
        }

        var a = 'hello'
        console.log(`${ a } world`);

    </script>
</body>
</html>